import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:test1/test_getx/Test_dependence_manager/test_logic.dart';

class Test_controller extends StatelessWidget {
  Test_controller({super.key});
  var logic = Get.put(CountController());
  var count = 0;
  @override
  StatelessElement createElement() {

    return super.createElement();
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: const Text('Test_controller')),
        body: Column(children: [
          Obx(() {
            return Text('${logic.count}');
          }),
          Obx(() {
            print('JtTag:构建');
            return Text('${logic.isOpen}');
          }),
          ElevatedButton(
              onPressed: () {
                logic.inc();
                print('JtTag:testName:1');
                print('JtTag:testName:2');
                print('JtTag:testName:3');
                print('JtTag:testName:4');
              },
              child: const Text('+')),
          ElevatedButton(
              onPressed: () {
                logic.dec();
              },
              child: const Text('-')),
          ElevatedButton(
              onPressed: () {
                // 验证刷新次数
                logic.close();
                logic.open();
                logic.close();
                logic.open();
                logic.close();
                logic.open();
              },
              child: const Text('switch'))
        ]));
  }

}
